<aside class="main-sidebar">

    <section class="sidebar">

        <!-- Sidebar user panel -->
        <div class="user-panel">
            <div class="pull-left image">
                <img src="<?= $directoryAsset ?>/img/user2-160x160.jpg"
                     class="img-circle" alt="User Image" />
            </div>
            <div class="pull-left info">
                <p><?= $username?>(<?= $role_name?>)</p>

                <a href="#"><i class="fa fa-circle text-success"></i><?= $is_logining?></a>
            </div>
        </div>

        <!-- search form -->
        <form action="#" method="get" class="sidebar-form">
            <div class="input-group">
                <input type="text" name="q" class="form-control" placeholder="搜索..." />
                <span class="input-group-btn">
					<button type='submit' name='search' id='search-btn'
                            class="btn btn-flat">
						<i class="fa fa-search"></i>
					</button>
				</span>
            </div>
        </form>
        <!-- /.search form -->
        <?php
        $controller = Yii::$app->controller->id;
        $action = $this->context->action->id;//view里面只能这样来获取action
        $moduleid = $this->context->module->id;//view里面只能这样来获取action
        $id = $this->context->id;//view里面只能这样来获取action
        $array = [
            [
                'active'=>($controller=="gii"),
                'label' => '生成MVC（Gii）',
                'icon' => 'file-code-o',
                'url' => [
                    '/gii'
                ]
            ],
            [
                'label' => '登录',
                'url' => [
                    'site/login'
                ],
                'visible' => Yii::$app->user->isGuest
            ],
            [
                'label' => '首页',
                'icon' => 'home',
                'url' => ['/site/index'],
            ],
            [
                'label' => '呼叫记录列表',
                'icon' => 'headphones',
                'url' => ['/asr-call/index'],
            ],
            [
                'label' => '呼叫计划列表',
                'icon' => 'paper-plane',
                'url' => ['asr-plan/index'],
            ],
            [
                'active'=>($controller=="asr-mobile"||$controller=="asr-customer"),
                'label' => '电话号码列表',
                'icon' => 'phone',
                'url' => ['/asr-mobile/index'],
            ],
            [
                'label' => '语音对话管理',
                'icon' => 'file-audio-o',
                'url' => ['#'],
                'items' => [
                    ['active'=>($controller=="asr-audio"),
                        'label' => '语音流程列表',
                        'icon' => 'paper-plane',
                        'url' => ['/asr-audio/index'],
                    ],
                    ['active'=>($controller=="asr-audio-classify"),
                        'label' => '语音流程种类',
                        'icon' => 'phone',
                        'url' => ['/asr-audio-classify/index'],
                    ],
                    ['active'=>($controller=="asr-flow-classify"),
                        'label' => '流程分类',
                        'icon' => 'phone',
                        'url' => ['/asr-flow-classify/index'],
                    ],
                ]
            ],
            [
                'label' => '权限管理',
                'icon' => 'hand-lizard-o',
                'url' => 'javascript:;',
                'items' => [
                    [
                        'active'=>($moduleid=="admin"&&($id=="route")),
                        'label' => '路由列表',
                        'icon' => 'hand-pointer-o',
                        'url' => [
                            '/admin/route'
                        ]
                    ],($role_name=='超级管理员')?
                        [
                            'active'=>($moduleid=="admin"&&($id=="permission")),
                            'label' => '权限列表',
                            'icon' => 'hand-rock-o',
                            'url' => [
                                '/admin/permission'
                            ]
                        ]:null,
                    [
                        'active'=>($moduleid=="admin"&&($id=="role")),
                        'label' => '角色列表',
                        'icon' => 'user',
                        'url' => [
                            '/admin/role'
                        ]
                    ],
                    [
                        'active'=>($moduleid=="admin"&&($id=="assignment")),
                        'label' => '用户与角色列表',
                        'icon' => 'users',
                        'url' => [
                            '/admin/assignment'
                        ]
                    ],
                    [
                        'active'=>($moduleid=="admin"&&($id=="rule")),
                        'label' => '规则列表',
                        'icon' => 'outdent',
                        'url' => [
                            '/admin/rule'
                        ]
                    ],
                    [
                        'active'=>($controller=="site"&&($action=="reset-password")),
                        'label' => '密码修改',
                        'icon' => 'reply',
                        'url' => [
                            '/site/reset-password'
                        ]
                    ],
                    [
                        'active'=>($moduleid=="admin"&&($id=="menu")),
                        'label' => '菜单列表',
                        'icon' => 'list',
                        'url' => [
                            '/admin/menu'
                        ]
                    ],($role_name=='超级管理员')?
                        [
                            'active'=>($controller=="site"&&($action=="signup")),
                            'label' => '注册页面',
                            'icon' => 'registered',
                            'url' => [
                                '/site/signup'
                            ]
                        ]:null,
                ]
            ],

        ];
        //		if ($role_name != "超级管理员") {
        //			foreach ( $array as $k => $arr ) {
        //				if ($arr ['label'] == '生成MVC（Gii）' || $arr ['label'] == '调试') {
        //					unset ( $array [$k] );
        //				}
        //			}
        //		}
        ?>
        <?=dmstr\widgets\Menu::widget ( [ 'options' => [ 'class' => 'sidebar-menu tree','data-widget' => 'tree' ],'items' => $array ] )?>

    </section>

</aside>